Animations are integral to web design, enriching user experiences through intuitive feedback, visual appeal, and attention-grabbing effects. They enhance engagement, communicate complex information effectively, and imbue brand identity. Used thoughtfully, animations elevate websites, fostering memorability, guiding users, and ultimately contributing to overall user satisfaction and conversion rates.
<button class="animate-spin rounded-full bg-blue-500 px-4 py-2 text-white">
Loading...
</button>
Use: It creates a continuous spinning motion, ideal for loading indicators
<button class="animate-pulse animate-fade rounded-full bg-green-500 px-4 py-2 text-white">
Click Me!
</button>
Use: This makes the element expand and contract simultaneously fading rhythmically, useful for highlighting important element.
<button class="animate-ping rounded-full bg-red-500 px-4 py-2 text-white">
Hover Me
</button>
Use: This button will have a scaling animation applied to it when hovered over.
<button class="animate-spin-slow rounded-full bg-yellow-500 px-4 py-2 text-white">
Wait...
</button>
Use: This button will have a slow spinning animation applied to it.
<div style="animation: fadeIn 0.5s ease-out;">
Content
</div>
<style>
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
</style>
<div style="animation: slideInRight 0.5s ease-out;">
Content
</div>
<style>
@keyframes slideInRight {
from { transform: translateX(100%); }
to { transform: translateX(0); }
}
</style>
<div style="animation: bounce 0.5s infinite;">
Content
</div>
<style>
@keyframes bounce {
0%, 100% { transform: translateY(-20px); }
50% { transform: translateY(0); }
}
</style>
<div style="animation: spin 1s linear infinite;">
Content
</div>
<style>
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>